<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/tld/pms-tag.tld" prefix="mypms" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>高级查询&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">

<link href="${ctx}/scripts/jscalendar-1.0/calendar-blue.css" rel="stylesheet" type="text/css">
<link href="${ctx}/scripts/jscalendar-1.0/calendar-blue2.css" rel="stylesheet" type="text/css">
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/calendar.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/lang/calendar-en.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/calendar-setup.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script>
var ACTION_URL="${ctx}/customer_customerAction.do?";

function init(){
	showChange();
	$('participantType1').disabled=true;
}

//当更改业主类型时，触发此方法
function showChange(){
	var code=$('participantType1').options[$('participantType1').selectedIndex].code;
	if( code == undefined || code == "" ){
		layer1.style.display="none";
		layer2.style.display="none";
	}else if (code=="001"){
		layer1.style.display="";
		layer2.style.display="none";
	}else{
		layer2.style.display="";
		layer1.style.display="none";
	}
}
//当住户类型为家庭成员时，业主类型锁定为个人
function changeCustomerType(o){
	var objType=$('participantType1');
	var code=o.options[o.selectedIndex].code;
	if( code == undefined || code == "" ){
		selectByType(objType,undefined);
		objType.disabled =true;
	}else if(code=='003' || code=='004'){
		selectByType(objType,'001');
		objType.disabled =true;
	}else{
		objType.disabled =false;
	}
}
//根据code值选择,objType为select控件
function selectByType(objType,code){
	for(var i=0;i<objType.options.length;i++){
		if(objType.options[i].code==code){
			objType.selectedIndex=i;
			showChange();
			return;
		}
	}
}



//开始查询
function submitSearch(){
	var url= ACTION_URL + "method=setSearchResidentCondition";
	var pars=formData();
	var myAjax = new Ajax.Request(
                    url,
                    {method: 'post', parameters: pars, onComplete: showResponse}
                    );
}

//响应结果
function showResponse(){
		var parentFrm = findFrame('main');
		parentFrm.searchClear();
		parentFrm.reloadFrame();
        windowClose();
}

//组装并返回可见的表单数据
function formData(){
	var object;
	if($(layer1).style.display=='none'){
		object=$(layer2).getElementsByTagName("input");
	}else{
		object=$(layer1).getElementsByTagName("input");
	}

	var str="houseNumber="+$F('houseNumber1')+"&customerType="+$F('customerType1')+"&participantType="+$F('participantType1')+"&";
	for(var i=0;i<object.length;i++){
		str =str+ object[i].name+"=" +object[i].value + "&";
	}
	return str;
}

//单选房间
function chooseSingleHouse(){
	var url="${ctx}/customer_chooseSingleHouseAction.do?method=chooseBuildingMain";
	windowOpen(url, 'in', '选择房间信息', 500, 650);
}

//设置房号信息
function setHouseInfo(houseId,houseNum){
	$('houseNumber1').value=houseNum;
}

</script>
</head>
<body onload="init();">

<form action="" id="gjSearch2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">高级查询</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" height="370" ""border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">房号：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input id="houseNumber1"  name="houseNumber" type="text" class="inputtext" size="16" value=""></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"  onClick="chooseSingleHouse();" onFocus="this.blur()"><img src="${ctx}/images/ico_houesno.GIF" alt="请点选查找房号" border="0"></a></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td class="aux_intable_td1">住户类型：</td>
            <td class="aux_intable_td2">
            	<mypms:Sysrefcode id="customerType1"  filterStr="'001','002'" name="customerType" onchange="changeCustomerType(this);"  code="CS_CLIENT_CLIENT_TYPE" style="width:110px" selectValue="${custsearchVO.customerType}"/>
            </td>
           </tr>
          <tr>
            <td class="aux_intable_td1">业主/租户类型：</td>
            <td class="aux_intable_td2">
				<mypms:Sysrefcode id="participantType1" showTip="false" selectValue="${custsearchVO.participantType}" name="participantType"  code="CS_PARTICIPANT_TYPE" style="width:110px" onchange="showChange();" />
			</td>
          </tr>
          <!-- 个人 -->
		  <tbody id="layer1" style="display:none;">
		  <tr>
            <td class="aux_intable_td1">住户姓名：</td>
            <td class="aux_intable_td2"><input name="customerName" type="text" class="inputtext"  size="16" value="${custsearchVO.participantType=='001' ? custsearchVO.customerName : ''}"></td>
            </tr>
          <tr>
            <td class="aux_intable_td1">证件号码：</td>
            <td class="aux_intable_td2"><input  name="idNO" type="text" class="inputtext" size="16" value="${custsearchVO.participantType=='001' ? custsearchVO.idNO : ''}"></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">联系电话：</td>
            <td valign="top" class="aux_intable_td2"><input  name="telephone" type="text" class="inputtext"  size="16" value="${custsearchVO.participantType=='001' ? custsearchVO.telephone : ''}"></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">入住日期：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input id="beginIndate1" name="beginInDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='001' ? custsearchVO.beginInDate : ''}"/>"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img  id="beginInButton1" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
              <td width="4">&nbsp;</td>
			  <td><input id="endInDate1" name="endInDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='001' ? custsearchVO.endInDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="endInButton1" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
              <td width="4">&nbsp;</td>

			  </tr>
            </table></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">搬出日期：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input id="beginOutDate1" name="beginOutDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='001' ? custsearchVO.beginOutDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="beginOutButton1" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
                <td width="4">&nbsp;</td>
                <td><input id="endOutDate1" name="endOutDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='001' ? custsearchVO.endOutDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="endOutButton1" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
              <td width="4">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">籍贯：</td>
            <td class="aux_intable_td2"><input  name="nativePlace" type="text" class="inputtext" value="${custsearchVO.participantType=='001' ? custsearchVO.nativePlace : ''}" size="16" ></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">兴趣爱好：</td>
            <td class="aux_intable_td2"><input  name="beInterestingIn" type="text" class="inputtext" value="${custsearchVO.participantType=='001' ? custsearchVO.beInterestingIn : ''}" size="16"></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">职业：</td>
            <td class="aux_intable_td2"><input  name="profession" type="text" class="inputtext" value="${custsearchVO.participantType=='001' ? custsearchVO.profession : ''}" size="16" ></td>
            </tr>
			</tbody>
		<!-- 企业 -->
		<tbody id="layer2" style="display:none;"  valign="top">
		  <tr>
            <td class="aux_intable_td1">单位名称：</td>
            <td class="aux_intable_td2"><input   name="customerName" type="text" class="inputtext" value="${custsearchVO.participantType=='002' ? custsearchVO.customerName : ''}" size="16"></td>
            </tr>
          <tr>
            <td class="aux_intable_td1">联系电话：</td>
            <td valign="top" class="aux_intable_td2"><input  name="telephone" type="text" class="inputtext" value="${custsearchVO.participantType=='002' ? custsearchVO.telephone : ''}" size="16"> </td>
          </tr>
          <tr>
            <td class="aux_intable_td1">入住日期：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input id="beginInDate2" name="beginInDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='002' ? custsearchVO.beginInDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="beginInButton2" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
              <td width="4">&nbsp;</td>
			  <td><input id="endInDate2" name="endInDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='002' ? custsearchVO.endInDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="endInButton2" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
              <td width="4">&nbsp;</td>
			  </tr>
            </table></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">搬出日期：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input id="beginOutDate2" name="beginOutDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='002' ? custsearchVO.beginOutDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="beginOutButton2" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
                <td width="4">&nbsp;</td>
                <td><input id="endOutDate2" name="endOutDate" type="text" class="inputtext" size="16" value="<fmt:formatDate value="${custsearchVO.participantType=='002' ? custsearchVO.endOutDate : ''}" />"></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"><img id="endOutButton2" src="${ctx}/images/ico_clock.gif" alt="请选择日期" border="0"></a></td>
                <td width="4">&nbsp;</td>

              </tr>
            </table></td>
          </tr>
          </tbody>

        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="submitSearch();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom"> 确 定</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom"> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>

</form>

<script type="text/javascript">
//住房类型为个人
			//入住日期
              Calendar.setup(
              {
	              inputField : "beginInDate1", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginInButton1", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

              Calendar.setup(
              {
	              inputField : "endInDate1", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endInButton1", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

			//搬出日期
              Calendar.setup(
              {
	              inputField : "beginOutDate1", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginOutButton1", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

              Calendar.setup(
              {
	              inputField : "endOutDate1", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endOutButton1", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

//住房类型为企业
			//入住日期
              Calendar.setup(
              {
	              inputField : "beginInDate2", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginInButton2", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

              Calendar.setup(
              {
	              inputField : "endInDate2", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endInButton2", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
			//搬出日期
              Calendar.setup(
              {
	              inputField : "beginOutDate2", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginOutButton2", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

              Calendar.setup(
              {
	              inputField : "endOutDate2", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endOutButton2", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

</script>

</body>
</html>